import pygame

from jeo.brick import Brick

class BrickManager:
    def __init__(self, gameworld):
        self.gameworld = gameworld
        self.last_time = pygame.time.get_ticks()
        self.interval = 1500

    def update(self, events):
        current_time = pygame.time.get_ticks()
        if current_time - self.last_time < self.interval:
            return

        b = Brick(self.gameworld)
        self.gameworld.goes.add(b)
        self.gameworld.bricks.add(b)

        self.last_time = current_time